package chapter1012;

import java.util.Arrays;

public class SimStudent {
    String name;
    int id;

    public void info(){
        System.out.println("Name: " + name + ",ID: "+ id);
    }
}

class Test{
    public static void main(String[] args) {
        SimStudent[] s = new SimStudent[5];
        for(int i=0;i<s.length;i++){
            s[i] = new SimStudent();
            s[i].name = String.valueOf(i);
            s[i].id = i;
        }
        SimStudent s1;


        for(int i=0;i<s.length;i++){
            for(int j=1;j<s.length-i;j++){
                if(s[j].id>s[j-1].id){
                    s1 = s[j-1];
                    s[j-1] = s[j];
                    s[j] = s1;
                }
            }
        }
        for(int i=0;i<s.length;i++){
            s[i].info();
        }
    }


}